package com.itboye.jinpuyiyuan.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.itboye.jinpuyiyuan.R;
import com.itboye.jinpuyiyuan.bean.GoodBean;

import java.util.ArrayList;

/**
 * Created by Administrator on 2017/12/26 0026.
 */

public class FindDoctorArrayAdapter extends BaseAdapter {

    private ArrayList<String> list;
    private Context context;
    private LayoutInflater inflater;
    public  FindDoctorArrayAdapter(Context context,ArrayList<String> list){

        this.list=list;
        this.context=context;
        inflater=LayoutInflater.from(context);
    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        FindDoctorViewHolder findDoctorViewHolder;
        if (convertView==null){
            findDoctorViewHolder=new FindDoctorViewHolder();
            convertView=inflater.inflate(R.layout.item_finddoctor_arrayitem,parent,false);
            findDoctorViewHolder.name=convertView.findViewById(R.id.name);
            convertView.setTag(findDoctorViewHolder);
        }else {
            findDoctorViewHolder= (FindDoctorViewHolder) convertView.getTag();
        }
        findDoctorViewHolder.name.setText(list.get(position));

        return convertView;
    }

    class FindDoctorViewHolder {
        TextView name;
    }
    public void addData(ArrayList<String> list){
        this.list=list;
        notifyDataSetChanged();
    }
}
